When deploying lambda function with terraform-aws-modules/lambda/aws Terraform module, and trying to add allowed_triggers to its configuration, e.g.:

allowed_triggers = {
    FlaConfigUploaded = {
      principal  = "events.amazonaws.com"
      source_arn = aws_cloudwatch_event_rule.fla_config_uploaded.arn
    }
  }

I got an error "We currently do not support adding policies for $LATEST".

The fix for this, is to add:

create_current_version_allowed_triggers = false

Ref: https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws/latest#faq

Q4: What does this error mean - "We currently do not support adding policies for $LATEST." ? Answer: When the Lambda function is created with publish = true the new version is automatically increased and a qualified identifier (version number) becomes available and will be used when setting Lambda permissions.

When publish = false (default), only unqualified identifier ($LATEST) is available which leads to the error.

The solution is to either disable the creation of Lambda permissions for the current version by setting create_current_version_allowed_triggers = false, or to enable publish of Lambda function (publish = true).